package com.upup.train_management.repository;

import com.upup.train_management.entity.Ticket;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TicketRepository extends JpaRepository<Ticket, Long> {
    Ticket findByTicketNumber(String ticketNumber);
    List<Ticket> findByScheduleId(Long scheduleId);
    List<Ticket> findByUserId(Long userId);
    List<Ticket> findByUserIdAndStatus(Long userId, String status);
    List<Ticket> findByScheduleIdAndStatus(Long scheduleId, String status);

    int countByScheduleIdAndStatusNot(Long scheduleId, String status);
}